<!--图片上传开始-->
<script type="text/javascript">
    var url = '/api/ueditor/index.html?app=admin';
    var upload_editor = UE.getEditor('input_editor',{
        serverUrl :url,
        UEDITOR_HOME_URL:'{:config('template.ueditor')}/',
    });
    function upImage(morepics){
        upload_editor.ready(function(){
            upload_editor.execCommand('serverparam', {
                'userid': {:session('userid')},
            });
            var pickey = 1;
            upload_editor.hide();
            upload_editor.addListener('beforeInsertImage', function (t,arg){
                if(pickey == 1){
                    if(morepics.indexOf('specimg') != -1){
                        $(morepics).html('<img src="'+arg[0].src+'" class="img-rounded" style="max-height:35px; max-width:100px;"><input type="hidden" value="'+arg[0].src+'" name="sku_specimg[]"><input type="button" class="btn btn-success" onClick="upImage(\''+morepics+'\');" value="{:lang('v_upload_img')}" />');
                    }else{
                        $(morepics).val(arg[0].src);
                    }
                }
                pickey ++;
            });
        });
        var myImage = upload_editor.getDialog("insertimage");
        myImage.open();
    }
</script>
<!--图片上传结束-->